<template>
  <div class="main">
    <el-button type="primary" @click="dialogVisible = true" size="mini">查看回复</el-button>
    <el-dialog
        title="回复查看"
        :visible.sync="dialogVisible"
        width="30%"
        :before-close="handleClose">
      <el-descriptions direction="vertical" :column="1" border>
        <el-descriptions-item label="问题">{{ row.question }}</el-descriptions-item>
        <el-descriptions-item label="专家回答">{{ row.answer }}</el-descriptions-item>
      </el-descriptions>
      <div class="block rate">
        <div style="float: right">
          <el-rate
              v-model="value"
              show-score
              text-color="#ff9900"
              score-template="{value}"></el-rate>
        </div>
        <div style="float: right">请给回复评分：</div>
      </div>
      <span slot="footer" class="dialog-footer">
        <el-button @click="dialogVisible = false">取 消</el-button>
        <el-button type="primary" @click="dialogVisible = false">确 定</el-button>
      </span>
    </el-dialog>
  </div>
</template>

<script>
export default {
  name: "ShowAnswer",
  props:["row"],
  data(){
    return{
      dialogVisible: false,
      value: 0,
    }
  },
  methods: {
    handleClose(done) {
      this.$confirm('确认关闭？')
        .then(_ => {
          done();
        })
        .catch(_ => {});
    }
  },
  created() {
    this.value = this.row.rate
  }
}
</script>

<style scoped>
  .main{
    width: 100%;
    margin: 10px;
    display: inline;
  }

  .rate{
    text-align: right;
    margin: 20px 20px 0;
  }
</style>